package com.trip.admin.datatables;


import com.trip.vo.Page;

/**
 * datatables输出
 * @author hc24
 * 2016年8月10日
 *
 */
public class DTOutput {
	private int draw;
	private long recordsTotal;
	private long recordsFiltered;
	private Object data;
	/** 友好错误提示 */
	private String error;

	public static DTOutput print(DTInput dtInput, Page<?> page){
		DTOutput dtOutput=new DTOutput();
		dtOutput.setData(page.getRows());
		dtOutput.setDraw(dtInput.getDram());/* 官方非要我返回这个东东，说为了安全防止攻击 */
		dtOutput.setRecordsTotal(page.getTotal());
		dtOutput.setRecordsFiltered(page.getTotal());

		return dtOutput;
	}

	public static DTOutput print(Object data){
		DTOutput dtOutput=new DTOutput();
		dtOutput.setData(data);
		return dtOutput;
	}
	
	public int getDraw() {
		return draw;
	}

	public void setDraw(int draw) {
		this.draw = draw;
	}

	public long getRecordsTotal() {
		return recordsTotal;
	}

	public void setRecordsTotal(long recordsTotal) {
		this.recordsTotal = recordsTotal;
	}

	public long getRecordsFiltered() {
		return recordsFiltered;
	}

	public void setRecordsFiltered(long recordsFiltered) {
		this.recordsFiltered = recordsFiltered;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

}
